home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / DEM / I-M / LineShare DEMO.sea / LineShare Scripts / Supra Fax2&MultiData < prev    next >
Text File  |  1993-01-28  |  6KB  |  280 lines

  1. !
  2. ! LineShare™ Script for SupraFax v32bis modems
  3. ! This script is designed for Class 2 fax software and -
  4. ! ••• Make sure that you have "H" or better ROMs in your modem!
  5. !
  6. ! This script is designed to use with fax and several data services:
  7. ! TeleFinder™ BBS ("TF" subPort)
  8. ! QuickMail™ MailServer ("Mail" subPort)
  9. ! The script displays the menu: this lines are marked with "@@@"
  10. ! The choice is done manually by the user when connecting to the host.
  11. !
  12. ! For some reasons TeleFinder redefines the LineFeed character (S4)
  13. ! We don't redefine it really, but we emulate modem responses with that symbol
  14. ! This trick is done in lines marked with '$$$$'
  15. !
  16. ! If you want to modify this script for your modem, pay attention to
  17. ! the line marked "#### Settings ####" - it should be modified first
  18. !
  19. ! The TeleFinder "Host Options" used:
  20. ! "Adjust BPS to line speed" - *disabled* (since we alsways return "CONNECT 19200")
  21. ! "Use Break Reset" - *enabled*,
  22. !
  23. ! The QuickMail options (through CTB module:)
  24. ! Don't adjust speed (since we alsways return "CONNECT 19200")
  25. !
  26. !
  27.  
  28. ! ------------------------------------------
  29. ! Resetting the modem:
  30. ! ------------------------------------------
  31. @Hangup
  32.   SetTries 2
  33.   Flush
  34.   HsReset 0,0,17,19,0,0
  35. !
  36. ! Try to catch the "OK" answer, use the Escape seq and DTR transitions
  37. ! to enter the command mode
  38. !
  39. @Label 1
  40.   matchclr
  41.   matchstr 1 2 "OK\r\n"
  42.   write "ATH0&F1\r"
  43.   matchread 20
  44.   Write "+++"
  45.   DtrClear
  46.   pause 10
  47.   DtrSet
  48. !
  49.   DecTries
  50.   IfTries 0 1
  51. !
  52. ! OSErr -6019 "Modem error - the modem is not responding"
  53. !
  54.   exit -6019
  55. @Label 2
  56.   write "AT+FCLASS=0\r"
  57.   Jsr 100
  58.   write "AT+FAA=0\r"
  59.   Jsr 100
  60.   exit 0
  61. ! ------------------------------------------
  62. !    Receiving incoming calls
  63. ! ------------------------------------------
  64. @ANSWER
  65. @Label 10
  66. !
  67. ! Set the modem preferred speed first
  68. !
  69.   SERRESET 2400,0,8,1
  70.   Jsr 80
  71. !
  72. ! Set the common options
  73.   Jsr 70
  74. !
  75. ! Set the communication options:
  76. ! X4 - Extended response set
  77. ! N1 - Connect at the highest rate
  78. ! \N3 - Enable MNP/v42 for TeleFinder and mail
  79. ! &K4 - Xon/Xoff flow control (for Fax)
  80. ! Fax mode (to enable fax tuning commands)
  81. !
  82. @Label 11
  83. ! #### Settings ####
  84.   Write "ATX4N1\\N3&K4+FCLASS=2\r"
  85.   Jsr 100
  86. !
  87. ! Set the "work" speed
  88. !
  89. @Label 12
  90.   SERRESET 19200,0,8,1
  91.   Jsr 80
  92. !
  93. ! Set Fax parameters: LID, DCC,BOR
  94. !
  95.   Write "AT+FLID=\"Stalker_GmbH\"\r"
  96.   Jsr 100
  97.   Write "AT+FDCC=1,3,0,2,0,0,0,0\r"
  98.   Jsr 100
  99.   Write "AT+FBOR=1\r"
  100.   Jsr 100
  101. !
  102. ! Allow modem to receive fax messages
  103. !
  104.   Write "AT+FCR=1\r"
  105.   Jsr 100
  106. !
  107. ! Tell the modem to determine the type of the incoming call
  108. ! Fetch the tube after N rings, where N has been set in the control panel (^4)
  109. !
  110.   Write "ATS0=^4+FAA=1\r"
  111.   Jsr 100
  112. !
  113. ! Everything is ready - let's sit and wait for a call
  114. ! We'll wait for 2 minutes, then reinitiate the modem
  115. @Label 20
  116.   MatchClr
  117.   matchstr 1 20 "RING\r"
  118.   matchstr 2 21 "CONNECT"
  119.   matchstr 13 30 "+FCON"
  120.   matchstr 14 10 "\r\nNO  "
  121.   matchstr 15 10 "BUSY"
  122.   Matchread 1200
  123.   jump 10
  124. !
  125. ! Data connection has been established (we read "CONNECT")
  126. ! Remove everything till "\r\n" from the buffer
  127. @Label 21
  128.   MatchClr
  129.   MatchStr 1 22 "\r\n"
  130.   MatchRead 10
  131.   exit -6019
  132. @Label 22
  133. !
  134. ! Display our menu
  135. ! @@@
  136.   Write "\r\n\n\n\nWelcome to Stalker Multi-Service Host!\r\n"
  137.   Write "\r\nPress a key to connect to:\r\n"
  138.   Write "M - TeleFinder(tm) BBS\r\n"
  139.   Write "Q - QuickMail(tm) mail-server\r\n"
  140.   Write "=>"
  141.   MatchClr
  142.   MatchStr 1 24 "M"
  143.   MatchStr 2 24 "m"
  144.   MatchStr 3 25 "Q"
  145.   MatchStr 4 25 "q"
  146.   MatchStr 5 23 "\r"
  147.   MatchRead 150
  148. @Label 23
  149.   exit -6019
  150. !
  151. ! Emulate the CONNECT 19200 message
  152. ! Attach the "TF" subPort
  153. ! The letter "M" is also put into the buffer,
  154. ! since it could be part of TeleFinder "MMM" 'entry mark'
  155. !
  156. @Label 24
  157.   Write "M\r\n\r\nConnecting to TeleFinder...\r\n"
  158.   QueueInput "\r\27CONNECT 19200\r\27M"
  159.   Attach "TF" (DTR,BREAK,RESET,ESCAPE,IDLELIMIT=60)
  160. !
  161. ! Emulate the CONNECT 19200 message
  162. ! Attach the "Mail" subPort
  163. ! The symbol "\r" is also put into the buffer,
  164. ! to force QuickMail to start the session
  165. !
  166. @Label 25
  167.   Write "Q\r\n\r\nConnecting to QuickMail...\r\n"
  168.   QueueInput "\r\nCONNECT 19200\r\n\r"
  169.   Attach "Mail" (DTR,ESCAPE)
  170. !
  171. ! Fax connection has been established (we read "+FCON")
  172. ! Put the +FCON back to the buffer,
  173. ! Put the "RING" before the "+FCON"
  174. ! Attach the "Fax" subPort
  175. !
  176. @Label 30
  177.   QueueInput "\r\nRING\r\n\r\n+FCON"
  178.   Attach "Fax" (DTR,RESET,ESCAPE,IDLELimit=30)
  179. ! ------------------------------------------
  180. ! Originating a call through the "Fax" subPort
  181. ! ------------------------------------------
  182. @ORIGINATE "Fax"
  183. !
  184. ! Set the "Fax" speed
  185. !
  186.   SERRESET 19200,0,8,1
  187.   Jsr 80
  188. !
  189. ! Set the common options
  190. !
  191.   Jsr 70
  192. !
  193. ! Set the Fax mode
  194. !
  195.   Write "AT+FCLASS=2\r"
  196.   Jsr 100
  197. !
  198. ! Now emit all commands that the application has sent to that port,
  199. ! Prepare to receive all error result codes
  200. !
  201.   Jsr 60
  202. !
  203. ! Prepare to connect
  204. !
  205.   Jsr 90
  206.   MatchStr 1 51 "\r\n+FCON"
  207.   HsReset *
  208.   Write "ATD^1\r"
  209.   MatchRead 700
  210.   Write "\r"
  211.   Exit -6019
  212. @LABEL 51
  213.   QueueInput "\r\n+FCON"
  214.   Attach "Fax" (DTR,RESET,ESCAPE,IDLELimit=30)
  215. !
  216. ! This section emits all modem commands sent by the client application
  217. ! For each set of commands the "OK" answer is awaited
  218. !
  219. @Label 60
  220.   EmitStart
  221. @Label 61
  222.   EmitCommand 62
  223.   Jsr 100
  224.   Jump 61
  225. @Label 62
  226.   return
  227. !
  228. ! This section initiates the modem before ANSWER and ORIGINATEs:
  229. ! speaker control +
  230. ! reset on Dtr drop + DCD valid
  231. ! Verbal responses mode, no echo 
  232. ! Set &S1 (DSR) in case the cable connects the DSR signal with the CTS pin
  233. !
  234. @Label 70
  235.   Write "ATM^2L^3&D2&C1V1E0\r"
  236.   Jsr 100
  237.   return 
  238. !
  239. ! This section syncronize the modem after the serial port speed switching
  240. !
  241. @Label 80
  242.   ChrDelay 1
  243.   Write "AT\r"
  244.   ChrDelay 0
  245.   Jsr 100
  246.   return
  247. !
  248. ! Prepare to receive error result codes
  249. !
  250. @Label 90
  251.   MatchClr
  252.   MatchStr 2 91 "NO DIALTONE\r\n"
  253.   MatchStr 3 92 "BUSY\r\n"
  254.   MatchStr 4 93 "NO CARRIER\r\n"
  255.   MatchStr 5 94 "NO ANSWER\r\n"
  256.   return
  257. @Label 91
  258.   exit -6020
  259. @Label 92
  260.   exit -6022
  261. @Label 93
  262.   exit -6021
  263. @Label 94
  264.   exit -6023
  265. !
  266. ! Processing the AT command:
  267. ! OK -> proceed
  268. ! ERROR or TimeOut ->exit -6019
  269. ! It can be called AFTER the "Write" command, since LineShare buffers input
  270. !
  271. @Label 100
  272.   MatchClr
  273.   MatchStr 1 102 "\r\nOK\r\n"
  274.   MatchStr 2 101 "\r\nERROR\r\n"
  275.   MatchRead 20
  276. @Label 101
  277.   Exit -6019
  278. @Label 102
  279.   return
  280.